<? include "./configs/session_check.php";?>
<? include "./configs/config.php";?>
<? include "select.class.php"; ?>
<? $_SESSION['TaskID']=$_GET['id'];?>
<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
	
	<title>.:: Task Tracker ::.</title>

<? include "./configs/includes.php";?>
    
    <script type="text/javascript">
		  $(document).ready(function() {
			$('#formclockout').hide();
			$("#accordion").accordion({ collapsible: true, active: false });
			$("#NoteTable").load("./NoteName.php");
		  });
  </script>
<meta charset="UTF-8" /></head>

<body>

	<div id="container">
		<div id="bgwrap">
			<div id="primary_left">
        
				<? include "./configs/left.php";?>
                 <!-- navigation menu end -->
			</div> <!-- sidebar end -->

			<div id="primary_right">
				<div class="inner">
				
				<? include "./configs/top.php";?>
					
					
					
					
				<div id="TaskTable">
                <?
                 $userid=$_SESSION['userid'];
				$TaskID=$_GET['id'];
				$task_query=mysql_query("SELECT * FROM Tasks WHERE TaskID='$TaskID'");
				$task_data=mysql_fetch_array($task_query);
				?>
                      <div class="two_third last column">
						  <div class="portlet">
							<div class="portlet-header"><?=$task_data['TaskTitle'];?></div>
							<div class="portlet-content" style="display: block;">
							
                            
                            <strong>Project ID:</strong><?=$task_data['ProjectID']?>&nbsp;&nbsp;&nbsp;&nbsp;
                            <strong>Assigned To:</strong><?=$task_data['AssigneTo']?>&nbsp;&nbsp;&nbsp;&nbsp;
                            <strong>Minutes Required:</strong><?=$task_data['MinutesRequired']?><br />
                           
                            <strong>Line Manager:</strong><?=$task_data['LineManager']?>&nbsp;&nbsp;&nbsp;
                            <strong>Priority:</strong><?=$task_data['Priority']?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <strong>Status:</strong><? if($task_data['Pause']==1) echo "Active";
							  else echo "Paused";?><br /><br />
                             <?=$task_data['TaskDetails'];?>
							</div>
						  </div>
						</div>
                      
                              <div class="one_third last column" >
						  <div class="portlet">
							<div class="portlet-header">Add Note</div>
							<div class="portlet-content" style="display: block;">
							 <form action="#" method="post">
               <input type="hidden" name="TaskID1" id="TaskID1" value="<?=$TaskID?>" />
                        	<p>
							<label>Note Title:</label>
							<input class="sf" name="NoteTitle1" id="NoteTitle1" type="text" value="note title" onblur="if (jQuery(this).val() == &quot;&quot;) { jQuery(this).val(&quot;note title&quot;); }" onclick="jQuery(this).val(&quot;&quot;);" />

							<label>Note Details:</label>
							<textarea name="NoteDetails1" id="NoteDetails1" rows="5" cols="25" class="sf" style="border:1px gray solid" ></textarea>
						
                       <div id="messagenote1" style="display: none;"></div>
                        <input class="button" type="submit" value="Submit" id="submitnote1" /></p>
                       </form>
                    
							</div>
						  </div>
						</div>
                        <h1></h1>

					<div id="NoteTable"></div>
                        
                  
                </div>
                
					
				
				</div> <!-- inner -->
			</div> <!-- primary_right -->
		</div> <!-- bgwrap -->
        <? include "./configs/footer.php";?>
	</div> <!-- container -->
         <script type="text/javascript">
        $(document).ready(function(){
	$('#submit').click(function() {				
		$.ajax({
			type : 'POST',
			url : 'ProcessProject.php',
			dataType : 'json',
			data: {
				ProjectTitle : $("#ProjectTitle").val(),
                DeadLine : $('#DeadLine').val(),
                ProjectManager : $('#ProjectManager').val(),
                Department : $('#Department').val(),
				Section : $('#Section').val()
			},
			success : function(data){
				
				$('#demoForm').show(100);
				$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success')
					.text(data.msg).show(100);
					
				//$('#price').val(data.price);
				if (data.error === true)
					$('#demoForm').show(100);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				
				$('#message').removeClass().addClass('error')
					.text('There was an error.').show(500);
				$('#demoForm').show(100);
			}
		});
		
		return false;
	});
	$('#submittask').click(function() {				
		$.ajax({
			type : 'POST',
			url : 'ProcessTask.php',
			dataType : 'json',
			data: {
				ProjectID : $("#ProjectID").val(),
                AssigneTo : $('#AssigneTo').val(),
                TaskTitle : $('#TaskTitle').val(),
				TaskDetails : $('#TaskDetails').val(),
                MinutesRequired : $('#MinutesRequired').val(),
				LineManager : $('#LineManager').val(),
				Priority : $('#Priority').val()
			},
			success : function(data){
				
				$('#messagetask').removeClass().addClass((data.error === true) ? 'error' : 'success')
					.text(data.msg).show(100);
				
				//$('#price').val(data.price);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				
				$('#messagetask').removeClass().addClass('error')
					.text('There was an error.').show(500);
				
			}
		});
		
		return false;
	});
		$('#submitnote').click(function() {				
		$.ajax({
			type : 'POST',
			url : 'ProcessNote.php',
			dataType : 'json',
			data: {
				TaskID : $("#TaskID").val(),
                NoteTitle : $('#NoteTitle').val(),
                NoteDetails : $('#NoteDetails').val()
			},
			success : function(data){
				
				$('#messagenote').removeClass().addClass((data.error === true) ? 'error' : 'success')
					.text(data.msg).show(100);
				//$('#price').val(data.price);
				$("#NoteTable").load("./NoteName.php");
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				
				$('#messagenote').removeClass().addClass('error')
					.text('There was an error.').show(500);
				
			}
		});
		
		return false;
	});
	$('#clockin').click(function() {				
		$.ajax({
			type : 'POST',
			url : 'ProcessClockin.php',
			dataType : 'json',
			data: {
				userid : $("#userid").val()
			},
			success : function(data){
				
				
					$('#formclockin').hide(500);
					$('#formclockout').show(100);
				//$('#price').val(data.price);
				if (data.error === true)
					$('#formclockin').show(100);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				
				$('#messageclockin').removeClass().addClass('error')
					.text('There was an error.').show(500);
				
			}
		});
		
		return false;
	});
	$('#clockout').click(function() {				
		$.ajax({
			type : 'POST',
			url : 'ProcessClockout.php',
			dataType : 'json',
			data: {
				userid : $("#userid").val()
			},
			success : function(data){
				
				
				//$('#price').val(data.price);
				$('#formclockin').show(100);
				$('#formclockout').hide(100);
				$('#logintimee').hide(200);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				
				$('#messageclockout').removeClass().addClass('error')
					.text('There was an error.').show(500);
				
			}
		});
		
		return false;
	});
		$('#submitnote1').click(function() {				
		$.ajax({
			type : 'POST',
			url : 'ProcessNote.php',
			dataType : 'json',
			data: {
				TaskID : $("#TaskID1").val(),
                NoteTitle : $('#NoteTitle1').val(),
                NoteDetails : $('#NoteDetails1').val()
			},
			success : function(data){
				
				$('#messagenote1').removeClass().addClass((data.error === true) ? 'error' : 'success')
					.text(data.msg).show(100);
				//$('#price').val(data.price);
				$("#NoteTable").load("./NoteName.php");
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				
				$('#messagenote1').removeClass().addClass('error')
					.text('There was an error.').show(500);
				
			}
		});
		
		return false;
	});

});
        </script>
</body>
</html>
